//
//  ZBMoBanSixViewController.m
//  MoBan
//
//  Created by apple on 16/7/13.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "ZBMoBanSixViewController.h"
#import "ZBMoBanSixUnit.h"
#import "ZBMoBanSixFirstCell.h"
#import "ZBMoBanSixSecondCell.h"
#import "ZBMoBanSixThreeCell.h"
@interface ZBMoBanSixViewController ()<UITableViewDataSource,UITableViewDelegate,ZBMoBanSixFirstCellDelegt>
@property(nonatomic,strong)UITableView *tableview;
@property(nonatomic,strong)NSMutableArray *array;
@end

@implementation ZBMoBanSixViewController
-(NSMutableArray *)array
{
    if (!_array) {
        _array = [NSMutableArray array];
    }
    return _array;
}
-(UITableView *)tableview
{
    if (!_tableview) {
        _tableview = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, KscrW, KscrH-KBar1)];
        _tableview.dataSource = self;
        _tableview.delegate = self;
//        _tableview.
        
    }
    return _tableview;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view addSubview:self.tableview];
    NSArray *array = @[@"哼哼哈嘿",@"我们使用双截棍"];
    [self.array addObject:array];
    // Do any additional setup after loading the view.
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (section<3) {
        return 1;
    }
    return self.array.count;

}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section==0) {
        ZBMoBanSixFirstCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ZBMoBanSixFirstCell"];
        if (!cell) {
            cell = [[ZBMoBanSixFirstCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"ZBMoBanSixFirstCell"];
        }
        cell.deleget = self;
        return cell;
    }else if (indexPath.section==1)
    {
        ZBMoBanSixSecondCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ZBMoBanSixSecondCell"];
        if (!cell) {
            cell = [[ZBMoBanSixSecondCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"ZBMoBanSixSecondCell"];
        }
        [cell ZBSetMessageWithSouce:self.array[0]];
        return cell;

    
    }else if (indexPath.section==2)
    {
    
        ZBMoBanSixThreeCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ZBMoBanSixThreeCell"];
        if (!cell) {
            cell = [[ZBMoBanSixThreeCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"ZBMoBanSixThreeCell"];
        }
    
        return cell;
    }
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (!cell) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
    }
    return cell;

}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 4;
}// Default is 1 if not implemented
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{

    return [ZBMoBanSixUnit ZBTableviewFotterViewHight:section];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return [ZBMoBanSixUnit ZBTableviewCellHight:indexPath.section];
}
- (nullable UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section;
{
    if (section==2) {
        UILabel *lable = [[UILabel alloc]init];
        lable.text = @"   商家通用";
        return lable;

    }
    return nil;

}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"%ld",(long)indexPath.section);
    
    if (indexPath.section==2) {
        [ZBProssHud showsuccessFrom:self.view with:@"评论详情"];

    }
}
//购买按钮
-(void)ZBBuyBtnClic;

{
    [ZBProssHud showsuccessFrom:self.view with:@"购买成功"];
}

@end
